import router from './routers'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// import {useUserStore} from "@/store/module/useStore.js";
// import request from "@/plugins/request.js";
NProgress.configure({ showSpinner: true });
router.beforeEach(async (to, from, next) => {
    NProgress.start()
    next()
    // const userStore = useUserStore()
    // console.log(to.fullPath)
    // const meta = to.meta;
    // if (meta && meta.requireAuth) {
    //     if (userStore.getToken) {
    //         let {data} = await request({
    //             url: 'account/getUserInfo'
    //         })
    //         userStore.setUserInfo(data)
    //         next()
    //     } else {
    //         next(`/login?redirect=${to.fullPath}`)
    //     }
    // } else {
    //     next()
    // }
})
router.afterEach((to) => {
    NProgress.done()
    const meta = to.meta;
    if (meta) {
        document.title = meta.title;
    }

})
